
import onFormAfterEvent from '../request-functions/onFormAfterEvent';

const batchAddSubTemplate = 'batchAddSub';
const batchAddSubTaleTemplate = 'batchAddSubTaleTemplate';
export default function(props, moduleId, key, value, data) {
    const {
        pk_org,
        form: {
            getAllFormValue,
            setAllFormValue
        },
        func_type
    } = this.props;

    let postData = {
        areaCode: this.state.currentForm,
        func_type: func_type,
        key: key, 
        model: getAllFormValue(batchAddSubTemplate),
        pk_org: pk_org
    };

    onFormAfterEvent(postData)
        .then((res) => {
            if(res.success && res.data && res.data.formData) {
                setAllFormValue({
                    [batchAddSubTemplate]: res.data.formData[this.state.currentForm]
                })
            }
        });
}
